package com.demo.helper;

import android.widget.TextView;

import androidx.annotation.DrawableRes;

import com.module.commonui.R;
import com.tg.appcommon.android.ResourcesUtil;

public class SignalHelper {
    public static void setSignalImage(boolean is4GDevice, TextView textView, int level){
        @DrawableRes int resid;
        if (is4GDevice){
            resid = R.drawable.ic_tange_global_signal_4g_4;
            if (level >= 75){
                resid = R.drawable.ic_tange_global_signal_4g_1;
            }else if (level >= 50){
                resid = R.drawable.ic_tange_global_signal_4g_2;
            }else if (level >= 25){
                resid = R.drawable.ic_tange_global_signal_4g_3;
            }
        }else{
            resid = R.drawable.ic_tange_global_signal_wifi_4;
            if (level >= 75){
                resid = R.drawable.ic_tange_global_signal_wifi_1;
            }else if (level >= 50){
                resid = R.drawable.ic_tange_global_signal_wifi_2;
            }else if (level >= 25){
                resid = R.drawable.ic_tange_global_signal_wifi_3;
            }
        }
        textView.setCompoundDrawablesWithIntrinsicBounds(ResourcesUtil.getDrawable(resid),  null, null, null);
    }
}
